package GM.diagram.providers;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
import org.eclipse.gmf.runtime.common.core.service.IOperation;
import org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider;
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
import org.eclipse.gmf.runtime.notation.View;

import GM.GMPackage;
import GM.diagram.edit.parts.ActionActionTypeEditPart;
import GM.diagram.edit.parts.AdGoalNamePriorityEditPart;
import GM.diagram.edit.parts.AgentNameEditPart;
import GM.diagram.edit.parts.AttributeMultiplicityNameType2EditPart;
import GM.diagram.edit.parts.AttributeMultiplicityNameTypeEditPart;
import GM.diagram.edit.parts.ContributionLinkWeightEditPart;
import GM.diagram.edit.parts.DefinitionDef2EditPart;
import GM.diagram.edit.parts.DefinitionDef3EditPart;
import GM.diagram.edit.parts.DefinitionDef4EditPart;
import GM.diagram.edit.parts.DefinitionDef5EditPart;
import GM.diagram.edit.parts.DefinitionDef6EditPart;
import GM.diagram.edit.parts.DefinitionDef7EditPart;
import GM.diagram.edit.parts.DefinitionDef8EditPart;
import GM.diagram.edit.parts.DefinitionDefEditPart;
import GM.diagram.edit.parts.EntityNameEditPart;
import GM.diagram.edit.parts.EventNameEditPart;
import GM.diagram.edit.parts.GoalNameEditPart;
import GM.diagram.edit.parts.MappingName2EditPart;
import GM.diagram.edit.parts.MappingName3EditPart;
import GM.diagram.edit.parts.MappingName4EditPart;
import GM.diagram.edit.parts.MappingName5EditPart;
import GM.diagram.edit.parts.MappingName6EditPart;
import GM.diagram.edit.parts.MappingName7EditPart;
import GM.diagram.edit.parts.MappingName8EditPart;
import GM.diagram.edit.parts.MappingNameEditPart;
import GM.diagram.edit.parts.OperationNameEditPart;
import GM.diagram.edit.parts.ReferenceMultiplicityName2EditPart;
import GM.diagram.edit.parts.ReferenceMultiplicityNameEditPart;
import GM.diagram.edit.parts.RefinementLinkTypeEditPart;
import GM.diagram.edit.parts.StateNameEditPart;
import GM.diagram.parsers.MessageFormatParser;
import GM.diagram.part.GMVisualIDRegistry;

/**
 * @generated
 */
public class GMParserProvider extends AbstractProvider implements
		IParserProvider {

	/**
	 * @generated
	 */
	private IParser goalNameDescription_5002Parser;

	/**
	 * @generated
	 */
	private IParser getGoalNameDescription_5002Parser() {
		if (goalNameDescription_5002Parser == null) {
			EAttribute[] features = new EAttribute[] {
					GMPackage.eINSTANCE.getObject_Name(),
					GMPackage.eINSTANCE.getGoal_Description() };
			MessageFormatParser parser = new MessageFormatParser(features);
			goalNameDescription_5002Parser = parser;
		}
		return goalNameDescription_5002Parser;
	}

	/**
	 * @generated
	 */
	private IParser adGoalNamePriority_5043Parser;

	/**
	 * @generated
	 */
	private IParser getAdGoalNamePriority_5043Parser() {
		if (adGoalNamePriority_5043Parser == null) {
			EAttribute[] features = new EAttribute[] {
					GMPackage.eINSTANCE.getObject_Name(),
					GMPackage.eINSTANCE.getAdGoal_Priority() };
			MessageFormatParser parser = new MessageFormatParser(features);
			adGoalNamePriority_5043Parser = parser;
		}
		return adGoalNamePriority_5043Parser;
	}

	/**
	 * @generated
	 */
	private IParser operationName_5049Parser;

	/**
	 * @generated
	 */
	private IParser getOperationName_5049Parser() {
		if (operationName_5049Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getObject_Name() };
			MessageFormatParser parser = new MessageFormatParser(features);
			operationName_5049Parser = parser;
		}
		return operationName_5049Parser;
	}

	/**
	 * @generated
	 */
	private IParser entityName_5053Parser;

	/**
	 * @generated
	 */
	private IParser getEntityName_5053Parser() {
		if (entityName_5053Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getObject_Name() };
			MessageFormatParser parser = new MessageFormatParser(features);
			entityName_5053Parser = parser;
		}
		return entityName_5053Parser;
	}

	/**
	 * @generated
	 */
	private IParser eventName_5056Parser;

	/**
	 * @generated
	 */
	private IParser getEventName_5056Parser() {
		if (eventName_5056Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getObject_Name() };
			MessageFormatParser parser = new MessageFormatParser(features);
			eventName_5056Parser = parser;
		}
		return eventName_5056Parser;
	}

	/**
	 * @generated
	 */
	private IParser actionActionType_5057Parser;

	/**
	 * @generated
	 */
	private IParser getActionActionType_5057Parser() {
		if (actionActionType_5057Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getAction_ActionType() };
			MessageFormatParser parser = new MessageFormatParser(features);
			actionActionType_5057Parser = parser;
		}
		return actionActionType_5057Parser;
	}

	/**
	 * @generated
	 */
	private IParser agentName_5058Parser;

	/**
	 * @generated
	 */
	private IParser getAgentName_5058Parser() {
		if (agentName_5058Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getObject_Name() };
			MessageFormatParser parser = new MessageFormatParser(features);
			agentName_5058Parser = parser;
		}
		return agentName_5058Parser;
	}

	/**
	 * @generated
	 */
	private IParser refinementLinkType_5059Parser;

	/**
	 * @generated
	 */
	private IParser getRefinementLinkType_5059Parser() {
		if (refinementLinkType_5059Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getRefinementLink_Type() };
			MessageFormatParser parser = new MessageFormatParser(features);
			refinementLinkType_5059Parser = parser;
		}
		return refinementLinkType_5059Parser;
	}

	/**
	 * @generated
	 */
	private IParser definitionDef_5040Parser;

	/**
	 * @generated
	 */
	private IParser getDefinitionDef_5040Parser() {
		if (definitionDef_5040Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getDefinition_Def() };
			MessageFormatParser parser = new MessageFormatParser(features);
			definitionDef_5040Parser = parser;
		}
		return definitionDef_5040Parser;
	}

	/**
	 * @generated
	 */
	private IParser mappingName_5060Parser;

	/**
	 * @generated
	 */
	private IParser getMappingName_5060Parser() {
		if (mappingName_5060Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getMapping_Name() };
			MessageFormatParser parser = new MessageFormatParser(features);
			mappingName_5060Parser = parser;
		}
		return mappingName_5060Parser;
	}

	/**
	 * @generated
	 */
	private IParser definitionDef_5041Parser;

	/**
	 * @generated
	 */
	private IParser getDefinitionDef_5041Parser() {
		if (definitionDef_5041Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getDefinition_Def() };
			MessageFormatParser parser = new MessageFormatParser(features);
			definitionDef_5041Parser = parser;
		}
		return definitionDef_5041Parser;
	}

	/**
	 * @generated
	 */
	private IParser mappingName_5061Parser;

	/**
	 * @generated
	 */
	private IParser getMappingName_5061Parser() {
		if (mappingName_5061Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getMapping_Name() };
			MessageFormatParser parser = new MessageFormatParser(features);
			mappingName_5061Parser = parser;
		}
		return mappingName_5061Parser;
	}

	/**
	 * @generated
	 */
	private IParser definitionDef_5042Parser;

	/**
	 * @generated
	 */
	private IParser getDefinitionDef_5042Parser() {
		if (definitionDef_5042Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getDefinition_Def() };
			MessageFormatParser parser = new MessageFormatParser(features);
			definitionDef_5042Parser = parser;
		}
		return definitionDef_5042Parser;
	}

	/**
	 * @generated
	 */
	private IParser mappingName_5062Parser;

	/**
	 * @generated
	 */
	private IParser getMappingName_5062Parser() {
		if (mappingName_5062Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getMapping_Name() };
			MessageFormatParser parser = new MessageFormatParser(features);
			mappingName_5062Parser = parser;
		}
		return mappingName_5062Parser;
	}

	/**
	 * @generated
	 */
	private IParser definitionDef_5044Parser;

	/**
	 * @generated
	 */
	private IParser getDefinitionDef_5044Parser() {
		if (definitionDef_5044Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getDefinition_Def() };
			MessageFormatParser parser = new MessageFormatParser(features);
			definitionDef_5044Parser = parser;
		}
		return definitionDef_5044Parser;
	}

	/**
	 * @generated
	 */
	private IParser mappingName_5063Parser;

	/**
	 * @generated
	 */
	private IParser getMappingName_5063Parser() {
		if (mappingName_5063Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getMapping_Name() };
			MessageFormatParser parser = new MessageFormatParser(features);
			mappingName_5063Parser = parser;
		}
		return mappingName_5063Parser;
	}

	/**
	 * @generated
	 */
	private IParser definitionDef_5045Parser;

	/**
	 * @generated
	 */
	private IParser getDefinitionDef_5045Parser() {
		if (definitionDef_5045Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getDefinition_Def() };
			MessageFormatParser parser = new MessageFormatParser(features);
			definitionDef_5045Parser = parser;
		}
		return definitionDef_5045Parser;
	}

	/**
	 * @generated
	 */
	private IParser mappingName_5064Parser;

	/**
	 * @generated
	 */
	private IParser getMappingName_5064Parser() {
		if (mappingName_5064Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getMapping_Name() };
			MessageFormatParser parser = new MessageFormatParser(features);
			mappingName_5064Parser = parser;
		}
		return mappingName_5064Parser;
	}

	/**
	 * @generated
	 */
	private IParser definitionDef_5046Parser;

	/**
	 * @generated
	 */
	private IParser getDefinitionDef_5046Parser() {
		if (definitionDef_5046Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getDefinition_Def() };
			MessageFormatParser parser = new MessageFormatParser(features);
			definitionDef_5046Parser = parser;
		}
		return definitionDef_5046Parser;
	}

	/**
	 * @generated
	 */
	private IParser mappingName_5065Parser;

	/**
	 * @generated
	 */
	private IParser getMappingName_5065Parser() {
		if (mappingName_5065Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getMapping_Name() };
			MessageFormatParser parser = new MessageFormatParser(features);
			mappingName_5065Parser = parser;
		}
		return mappingName_5065Parser;
	}

	/**
	 * @generated
	 */
	private IParser definitionDef_5047Parser;

	/**
	 * @generated
	 */
	private IParser getDefinitionDef_5047Parser() {
		if (definitionDef_5047Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getDefinition_Def() };
			MessageFormatParser parser = new MessageFormatParser(features);
			definitionDef_5047Parser = parser;
		}
		return definitionDef_5047Parser;
	}

	/**
	 * @generated
	 */
	private IParser mappingName_5066Parser;

	/**
	 * @generated
	 */
	private IParser getMappingName_5066Parser() {
		if (mappingName_5066Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getMapping_Name() };
			MessageFormatParser parser = new MessageFormatParser(features);
			mappingName_5066Parser = parser;
		}
		return mappingName_5066Parser;
	}

	/**
	 * @generated
	 */
	private IParser definitionDef_5048Parser;

	/**
	 * @generated
	 */
	private IParser getDefinitionDef_5048Parser() {
		if (definitionDef_5048Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getDefinition_Def() };
			MessageFormatParser parser = new MessageFormatParser(features);
			definitionDef_5048Parser = parser;
		}
		return definitionDef_5048Parser;
	}

	/**
	 * @generated
	 */
	private IParser mappingName_5067Parser;

	/**
	 * @generated
	 */
	private IParser getMappingName_5067Parser() {
		if (mappingName_5067Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getMapping_Name() };
			MessageFormatParser parser = new MessageFormatParser(features);
			mappingName_5067Parser = parser;
		}
		return mappingName_5067Parser;
	}

	/**
	 * @generated
	 */
	private IParser attributeMultiplicityNameType_5050Parser;

	/**
	 * @generated
	 */
	private IParser getAttributeMultiplicityNameType_5050Parser() {
		if (attributeMultiplicityNameType_5050Parser == null) {
			EAttribute[] features = new EAttribute[] {
					GMPackage.eINSTANCE.getAttribute_Multiplicity(),
					GMPackage.eINSTANCE.getAttribute_Name(),
					GMPackage.eINSTANCE.getAttribute_Type() };
			MessageFormatParser parser = new MessageFormatParser(features);
			parser.setViewPattern("{0} {1}: {2}"); //$NON-NLS-1$
			parser.setEditorPattern("{0} {1}: {2}"); //$NON-NLS-1$
			parser.setEditPattern("{0} {1}: {2}"); //$NON-NLS-1$
			attributeMultiplicityNameType_5050Parser = parser;
		}
		return attributeMultiplicityNameType_5050Parser;
	}

	/**
	 * @generated
	 */
	private IParser referenceMultiplicityName_5051Parser;

	/**
	 * @generated
	 */
	private IParser getReferenceMultiplicityName_5051Parser() {
		if (referenceMultiplicityName_5051Parser == null) {
			EAttribute[] features = new EAttribute[] {
					GMPackage.eINSTANCE.getReference_Multiplicity(),
					GMPackage.eINSTANCE.getReference_Name() };
			MessageFormatParser parser = new MessageFormatParser(features);
			parser.setViewPattern("{0} {1}"); //$NON-NLS-1$
			parser.setEditorPattern("{0} {1}"); //$NON-NLS-1$
			parser.setEditPattern("{0} {1}"); //$NON-NLS-1$
			referenceMultiplicityName_5051Parser = parser;
		}
		return referenceMultiplicityName_5051Parser;
	}

	/**
	 * @generated
	 */
	private IParser stateName_5052Parser;

	/**
	 * @generated
	 */
	private IParser getStateName_5052Parser() {
		if (stateName_5052Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getState_Name() };
			MessageFormatParser parser = new MessageFormatParser(features);
			stateName_5052Parser = parser;
		}
		return stateName_5052Parser;
	}

	/**
	 * @generated
	 */
	private IParser attributeMultiplicityNameType_5054Parser;

	/**
	 * @generated
	 */
	private IParser getAttributeMultiplicityNameType_5054Parser() {
		if (attributeMultiplicityNameType_5054Parser == null) {
			EAttribute[] features = new EAttribute[] {
					GMPackage.eINSTANCE.getAttribute_Multiplicity(),
					GMPackage.eINSTANCE.getAttribute_Name(),
					GMPackage.eINSTANCE.getAttribute_Type() };
			MessageFormatParser parser = new MessageFormatParser(features);
			parser.setViewPattern("{0} {1}: {2}"); //$NON-NLS-1$
			parser.setEditorPattern("{0} {1}: {2}"); //$NON-NLS-1$
			parser.setEditPattern("{0} {1}: {2}"); //$NON-NLS-1$
			attributeMultiplicityNameType_5054Parser = parser;
		}
		return attributeMultiplicityNameType_5054Parser;
	}

	/**
	 * @generated
	 */
	private IParser referenceMultiplicityName_5055Parser;

	/**
	 * @generated
	 */
	private IParser getReferenceMultiplicityName_5055Parser() {
		if (referenceMultiplicityName_5055Parser == null) {
			EAttribute[] features = new EAttribute[] {
					GMPackage.eINSTANCE.getReference_Multiplicity(),
					GMPackage.eINSTANCE.getReference_Name() };
			MessageFormatParser parser = new MessageFormatParser(features);
			parser.setViewPattern("{0} {1}"); //$NON-NLS-1$
			parser.setEditorPattern("{0} {1}"); //$NON-NLS-1$
			parser.setEditPattern("{0} {1}"); //$NON-NLS-1$
			referenceMultiplicityName_5055Parser = parser;
		}
		return referenceMultiplicityName_5055Parser;
	}

	/**
	 * @generated
	 */
	private IParser contributionLinkWeight_6001Parser;

	/**
	 * @generated
	 */
	private IParser getContributionLinkWeight_6001Parser() {
		if (contributionLinkWeight_6001Parser == null) {
			EAttribute[] features = new EAttribute[] { GMPackage.eINSTANCE
					.getContributionLink_Weight() };
			MessageFormatParser parser = new MessageFormatParser(features);
			contributionLinkWeight_6001Parser = parser;
		}
		return contributionLinkWeight_6001Parser;
	}

	/**
	 * @generated
	 */
	protected IParser getParser(int visualID) {
		switch (visualID) {
		case GoalNameEditPart.VISUAL_ID:
			return getGoalNameDescription_5002Parser();
		case AdGoalNamePriorityEditPart.VISUAL_ID:
			return getAdGoalNamePriority_5043Parser();
		case OperationNameEditPart.VISUAL_ID:
			return getOperationName_5049Parser();
		case EntityNameEditPart.VISUAL_ID:
			return getEntityName_5053Parser();
		case EventNameEditPart.VISUAL_ID:
			return getEventName_5056Parser();
		case ActionActionTypeEditPart.VISUAL_ID:
			return getActionActionType_5057Parser();
		case AgentNameEditPart.VISUAL_ID:
			return getAgentName_5058Parser();
		case RefinementLinkTypeEditPart.VISUAL_ID:
			return getRefinementLinkType_5059Parser();
		case DefinitionDefEditPart.VISUAL_ID:
			return getDefinitionDef_5040Parser();
		case MappingNameEditPart.VISUAL_ID:
			return getMappingName_5060Parser();
		case DefinitionDef2EditPart.VISUAL_ID:
			return getDefinitionDef_5041Parser();
		case MappingName2EditPart.VISUAL_ID:
			return getMappingName_5061Parser();
		case DefinitionDef3EditPart.VISUAL_ID:
			return getDefinitionDef_5042Parser();
		case MappingName3EditPart.VISUAL_ID:
			return getMappingName_5062Parser();
		case DefinitionDef4EditPart.VISUAL_ID:
			return getDefinitionDef_5044Parser();
		case MappingName4EditPart.VISUAL_ID:
			return getMappingName_5063Parser();
		case DefinitionDef5EditPart.VISUAL_ID:
			return getDefinitionDef_5045Parser();
		case MappingName5EditPart.VISUAL_ID:
			return getMappingName_5064Parser();
		case DefinitionDef6EditPart.VISUAL_ID:
			return getDefinitionDef_5046Parser();
		case MappingName6EditPart.VISUAL_ID:
			return getMappingName_5065Parser();
		case DefinitionDef7EditPart.VISUAL_ID:
			return getDefinitionDef_5047Parser();
		case MappingName7EditPart.VISUAL_ID:
			return getMappingName_5066Parser();
		case DefinitionDef8EditPart.VISUAL_ID:
			return getDefinitionDef_5048Parser();
		case MappingName8EditPart.VISUAL_ID:
			return getMappingName_5067Parser();
		case AttributeMultiplicityNameTypeEditPart.VISUAL_ID:
			return getAttributeMultiplicityNameType_5050Parser();
		case ReferenceMultiplicityNameEditPart.VISUAL_ID:
			return getReferenceMultiplicityName_5051Parser();
		case StateNameEditPart.VISUAL_ID:
			return getStateName_5052Parser();
		case AttributeMultiplicityNameType2EditPart.VISUAL_ID:
			return getAttributeMultiplicityNameType_5054Parser();
		case ReferenceMultiplicityName2EditPart.VISUAL_ID:
			return getReferenceMultiplicityName_5055Parser();
		case ContributionLinkWeightEditPart.VISUAL_ID:
			return getContributionLinkWeight_6001Parser();
		}
		return null;
	}

	/**
	 * Utility method that consults ParserService
	 * @generated
	 */
	public static IParser getParser(IElementType type, EObject object,
			String parserHint) {
		return ParserService.getInstance().getParser(
				new HintAdapter(type, object, parserHint));
	}

	/**
	 * @generated
	 */
	public IParser getParser(IAdaptable hint) {
		String vid = (String) hint.getAdapter(String.class);
		if (vid != null) {
			return getParser(GMVisualIDRegistry.getVisualID(vid));
		}
		View view = (View) hint.getAdapter(View.class);
		if (view != null) {
			return getParser(GMVisualIDRegistry.getVisualID(view));
		}
		return null;
	}

	/**
	 * @generated
	 */
	public boolean provides(IOperation operation) {
		if (operation instanceof GetParserOperation) {
			IAdaptable hint = ((GetParserOperation) operation).getHint();
			if (GMElementTypes.getElement(hint) == null) {
				return false;
			}
			return getParser(hint) != null;
		}
		return false;
	}

	/**
	 * @generated
	 */
	private static class HintAdapter extends ParserHintAdapter {

		/**
		 * @generated
		 */
		private final IElementType elementType;

		/**
		 * @generated
		 */
		public HintAdapter(IElementType type, EObject object, String parserHint) {
			super(object, parserHint);
			assert type != null;
			elementType = type;
		}

		/**
		 * @generated
		 */
		public Object getAdapter(Class adapter) {
			if (IElementType.class.equals(adapter)) {
				return elementType;
			}
			return super.getAdapter(adapter);
		}
	}

}
